Add a popover menu example to gtk3-widget-factory
authorMatthias Clasen <mclasen@redhat.com>
Sun, 27 Apr 2014 16:13:06 +0000 (12:13 -0400)
committerMatthias Clasen <mclasen@redhat.com>
Sun, 27 Apr 2014 16:13:35 +0000 (12:13 -0400)
demos/widget-factory/widget-factory.c
demos/widget-factory/widget-factory.ui

index 937dc63e8814e1819d76d9626e9a1b7b08b3b1ab..7404e5967413912efda8e8bc1878c71e4c85395a 100644 (file)
@@ -286,6 +286,13 @@ main (int argc, char *argv[])
   static GActionEntry app_entries[] = {
     { "about", activate_about, NULL, NULL, NULL },
     { "quit", activate_quit, NULL, NULL, NULL },
+
+    { "main", NULL, "s", "''", NULL },
+    { "wine", NULL, NULL, "false", NULL },
+    { "beer", NULL, NULL, "false", NULL },
+    { "water", NULL, NULL, "false", NULL },
+    { "dessert", NULL, "s", "''", NULL }
+
   };
   gint status;
 
index abd1ddba7a4f4e6349337a2f8ebd39861b73898e..cfe5905674fafdf29f3a1b994b529c03b06dacae 100644 (file)
       </item>
     </section>
   </menu>
+  <menu id="dinner_menu">
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Steak</attribute>
+        <attribute name="action">app.main</attribute>
+        <attribute name="target">steak</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Pizza</attribute>
+        <attribute name="action">app.main</attribute>
+        <attribute name="target">pizza</attribute>
+      </item>
+    </section>
+    <section>
+      <item>
+        <attribute name="label" translatable="yes">Wine</attribute>
+        <attribute name="action">app.wine</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Beer</attribute>
+        <attribute name="action">app.beer</attribute>
+      </item>
+      <item>
+        <attribute name="label" translatable="yes">Water</attribute>
+        <attribute name="action">app.water</attribute>
+      </item>
+    </section>
+    <section>
+      <submenu>
+        <attribute name="label" translatable="yes">Dessert</attribute>
+        <section>
+          <item>
+            <attribute name="label" translatable="yes">Brownies</attribute>
+            <attribute name="action">app.dessert</attribute>
+            <attribute name="target">brownies</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">Banana Sundae</attribute>
+            <attribute name="action">app.dessert</attribute>
+            <attribute name="target">sundae</attribute>
+          </item>
+          <item>
+            <attribute name="label" translatable="yes">Lemon Bars</attribute>
+            <attribute name="action">app.dessert</attribute>
+            <attribute name="target">bars</attribute>
+          </item>
+        </section>
+      </submenu>
+    </section>
+  </menu>
   <object class="GtkAdjustment" id="adjustment1">
     <property name="upper">100</property>
     <property name="value">50</property>
@@ -1921,15 +1971,6 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
                         <property name="top-attach">0</property>
                       </packing>
                     </child>
-                    <child>
-                      <object class="GtkLabel" id="filler1">
-                        <property name="visible">True</property>
-                      </object>
-                      <packing>
-                        <property name="left-attach">1</property>
-                        <property name="top-attach">0</property>
-                      </packing>
-                    </child>
                     <child>
                       <object class="GtkLabel" id="filler2">
                         <property name="visible">True</property>
@@ -2087,6 +2128,31 @@ Suspendisse feugiat quam quis dolor accumsan cursus. </property>
                         <property name="top-attach">3</property>
                       </packing>
                     </child>
+                    <child>
+                      <object class="GtkBox">
+                        <property name="visible">True</property>
+                        <property name="orientation">horizontal</property>
+                        <child>
+                          <object class="GtkMenuButton">
+                            <property name="visible">True</property>
+                            <property name="menu-model">dinner_menu</property>
+                            <property name="halign">center</property>
+                            <property name="valign">center</property>
+                            <child>
+                              <object class="GtkImage">
+                                <property name="visible">True</property>
+                                <property name="icon-name">document-open-recent-symbolic</property>
+                                <property name="icon-size">4</property>
+                              </object>
+                            </child>
+                          </object>
+                        </child>
+                      </object>
+                      <packing>
+                        <property name="left-attach">1</property>
+                        <property name="top-attach">0</property>
+                      </packing>
+                    </child>
                   </object>
                 </child>
               </object>